*     ***************************************************************** *;
*     ***************************************************************** *;
*       File-Name:      dofile_district_final.do                        *;
*       Date:           25/09/2024                                      *;
*       Authors:        Baccini & Weymouth                              *;
*       Purpose:        Replication of "Inflation, Blame Attribution,   *;
*       and the 2022 US Congressional Elections"                        *;
*       Input Files:    dataset_district_final.dta         				*; 
*       Output Files:   bjps_replication.log                            *;
*       Machine:        Office                                          *;
*       Program: 		Stata 15                                        *;
*     ****************************************************************  *;
*     ****************************************************************  *;

clear
clear matrix
clear mata

*Upload the data
cd "C:\Users\lbacci\Dropbox\Projects\Baccini Weymouth Inflation\survey\survey_new\0 Replication"
use dataset_district_final, clear 
*log using bjps_replication_district.log

*Matrix controls
global controls1 unemployment2021 college2020 fd_unem age_55over2020 foreignborn2020 white_nonhispanic2020

*Table A1
*1
reghdfe hr_2022 gas_fd, absorb(id_state) cluster(id_state)
outreg2 using tableA1.xls, bdec(4) tdec(3) addstat(`e(r2_p)') addtext(Controls, No, State fixed effects, Yes, Pop decile fixed effects, No) keep(gas_fd) label
*2
reghdfe hr_2022 rent_fd, absorb(id_state) cluster(id_state)
outreg2 using tableA1.xls, bdec(4) tdec(3) addstat(`e(r2_p)') addtext(Controls, No, State fixed effects, Yes, Pop decile fixed effects, No) keep(rent_fd) label append
*3
reghdfe hr_2022 gas_fd rent_fd, absorb(id_state) cluster(id_state)
outreg2 using tableA1.xls, bdec(4) tdec(3) addstat(`e(r2_p)') addtext(Controls, No, State fixed effects, Yes, Pop decile fixed effects, No) keep(gas_fd rent_fd) label append
*4
reghdfe hr_2022 gas_fd rent_fd $controls1, absorb(id_state pct_pop) cluster(id_state)
outreg2 using tableA1.xls, bdec(5) tdec(3) addstat(`e(r2_p)') addtext(Controls, Yes, State fixed effects, Yes, Pop decile fixed effects, Yes) keep(gas_fd rent_fd) label append

log close
